
message = Map();
finalResponse = "";
if(!arguments.contains(" in "))
{
	finalResponse = "In order to search Yelp, please follow this format:\n/yelp *type of food* in *location*";
}
else
{
	getIn = arguments.indexOf(" in ");
	term = arguments.substring(0,getIn);
	location = arguments.subString(getIn + 5,arguments.length());
	response = invokeurl
	[
		url :"https://api.yelp.com/v3/businesses/search"
		type :GET
		parameters:{"term":term,"location":location,"limit":5}
		connection:"INSERT_CONNECTION_NAME"
	];
	info response;
	if(response.contains("error"))
	{
		err = response.get("error");
		if(err.get("code") == "LOCATION_NOT_FOUND")
		{
			finalResponse = "Error: Location is not compatible with Yelp yet, please enter a different location.";
		}
	}
	else
	{
		business = response.getJSON("businesses").toJSONList();
		i = 0;
		for each  biz in business
		{
			i = i + 1;
			bizURL = biz.getJSON("url");
			rating = biz.getJSON("rating");
			rating = "(" + rating + "/5.0)";
			name = biz.getJSON("name");
			id = biz.getJSON("id");
			if(name.contains("&"))
			{
				name = replaceAll(name,"&","and");
			}
			if(name.contains("'"))
			{
				name = name.remove("'");
			}
			finalResponse = finalResponse + i + ". " + name + " " + rating + " " + "[See Details](invoke.function|INSERT_YOUR_FUNCTION_NAME|INSERT_YOUR_EMAIL_ID|" + id + ")\n";
		}
	}
}
message.put("text",finalResponse);
return message;
